//
//  DJDemoViewController.swift
//  DJWeibo
//
//  Created by demo on 2017/2/27.
//  Copyright © 2017年 demo. All rights reserved.
//

import UIKit

class DJDemoViewController: DJBaseViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        //设置标题
        title = "第 \(navigationController?.childViewControllers.count ?? 0) 个"
        //解包，或者直接把?改为!也可以
    }

        // Do any additional setup after loading the view.
        
// MARK: - 监听方法
        //继续push一个新的控制器
        @objc fileprivate func showNext(){
            let vc = DJDemoViewController()
            navigationController?.pushViewController(vc, animated: true)
            
        }
}

extension DJDemoViewController{

    override func setupTableView() {
        super.setupTableView()
        navItem.rightBarButtonItem = UIBarButtonItem(title: "下一个", target: self, action: #selector(showNext))
    }
    
//    override func setupUI() {
//        
//        super.setupUI()
        //设置右侧的控制器
       // navigationItem.rightBarButtonItem = UIBarButtonItem(title:"下一个",style:.plain,target:self,action:#selector(showNext))
      //  view.backgroundColor = UIColor.cz_random()
      /*  let btn:UIButton = UIButton.cz_textButton("下一个", fontSize: 16, normalColor: UIColor.darkGray, highlightedColor: UIColor.orange)
        btn.addTarget(self, action: #selector(showNext), for: .touchUpInside)
        navigationItem.rightBarButtonItem = UIBarButtonItem(customView:btn)
 */
        
        
    }

